package com.bd.scm.module.rule.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bd.scm.dao.mapper.rule.KtMjRuleMapper;
import com.bd.scm.dao.mapper.rule.MjRuleRealMapper;
import com.bd.scm.domain.models.rule.KtMjRule;
import com.bd.scm.domain.models.rule.MjRuleReal;
import com.bd.scm.module.rule.service.IKtMjRuleService;
import com.bd.scm.module.rule.service.IMjRuleRealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author yufc
 * @since 2019-09-03
 */
@Service
public class KtMjRuleServiceImpl extends ServiceImpl<KtMjRuleMapper, KtMjRule> implements IKtMjRuleService {

    @Autowired
    private KtMjRuleMapper ktMjRuleMapper;


    /**
     * 根据条件查数据列表
     *
     * @param queryWrapper
     * @return
     */
    @Override
    public List<KtMjRule> getList(QueryWrapper queryWrapper) {
        return ktMjRuleMapper.selectList(queryWrapper);
    }

    /**
     * 根据规则ID查询
     *
     * @param ruleId
     * @return
     */
    @Override
    public KtMjRule getByRuleId(int ruleId) {
        return ktMjRuleMapper.selectOne(new QueryWrapper<KtMjRule>().eq("serial",ruleId));
    }

    /**
     * 根据编号查询
     *
     * @param number
     * @return
     */
    @Override
    public KtMjRule getByNumber(String number) {

        return ktMjRuleMapper.selectOne(new QueryWrapper<KtMjRule>().eq("bh",number));
    }
}
